﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using DocumentManagement.Models;
using System.Windows;
using System.Windows.Data;

namespace DocumentManagement.ViewsModels
{
  public  class ReportDocumentINViewsModel : ViewsModelBase
    {
        public QSHCEntities1 _entityModels;
        public QSHCEntities1 EntityModels
        {
            get { return _entityModels; }
            set
            {
                if (_entityModels != value)
                {
                    _entityModels = value;
                    OnPropertyChanged("EntityModels");
                }
            }
        }

        public ICollectionView _myReceiveICV;
        public ICollectionView MyReceiveICV
        {
            get { return _myReceiveICV; }
            set
            {
                if (_myReceiveICV != value)
                {
                    _myReceiveICV = value;
                    OnPropertyChanged("MyReceiveICV");
                }
            }
        }

        private int _myText1;
        public int MyText1
        {
            get { return _myText1; }
            set
            {
                if (_myText1 != value)
                {
                    _myText1 = value;
                    OnPropertyChanged("MyText1");
                }
            }
        }
        private int _myText2;
        public int MyText2
        {
            get { return _myText2; }
            set
            {
                if (_myText2 != value)
                {
                    _myText2 = value;
                    OnPropertyChanged("MyText2");
                }
            }
        }
        private int _myText3;
        public int MyText3
        {
            get { return _myText3; }
            set
            {
                if (_myText3 != value)
                {
                    _myText3 = value;
                    OnPropertyChanged("MyText3");
                }
            }
        }




        public ReportDocumentINViewsModel()
        {
            if (!DesignerProperties.GetIsInDesignMode(new DependencyObject()))
            {
                EntityModels = new QSHCEntities1();

                MyReceiveICV = CollectionViewSource.GetDefaultView(EntityModels.Receives.Where(p => p.Active == true).ToList()); //.Where(p => p.Active == true)

                MyText1 = EntityModels.Receives.Count(p => p.Active == true);
                MyText2 = EntityModels.Receives.Count(p => p.Type == 1);
                MyText3 = EntityModels.Receives.Count(p => p.Type == 2);



            }
        }

      
    }
}
